<template>
  <div>
    <van-uploader :after-read="afterRead">
      <van-button icon="plus" type="primary">上传文件</van-button>
    </van-uploader>
    <div style="width: 1000px; height: 1000px" id="dicomImage"></div>
  </div>
</template>

<script>
import { getExampleImage } from "@/utils/loaderImg";
import cornerstone from "cornerstone-core";
import dicomParser from "dicom-parser";

export default {
  data() {
    return {
      fileList: [],
    };
  },
  mounted() {
      console.log(dicomParser);
  },

  methods: {
    afterRead(file) {
      let res = file.content.slice(file.content.indexOf(",") + 1);
      cornerstone.registerImageLoader("example", getExampleImage);
      const imageId = "example://2";
      const element = document.getElementById("dicomImage");
      cornerstone.enable(element);
      cornerstone.loadImage(imageId,res).then(function (image) {
        cornerstone.displayImage(element, image);
      });
      console.log(res);
    },
  },
};
</script>

<style>
</style>